
#include <fstream>
#include <iostream>
using namespace std;


int main( void ) {
	ifstream ifs2( "./file", ios::ate );
	if( ifs2 ) {
		cerr << "ifs2 err" << endl;
	}

	cout << "--------------first---------------" << endl;
	int ii; double dd; string ss1, ss2;
	ifs2 >> ii >> dd >> ss1 >> ss2;
	if( !ifs2 ) {
		cout << "ifs2 read err" << endl;
		cout << ifs2.good( ) << ifs2.bad( ) << ifs2.eof( ) << ifs2.fail( ) << endl;
		cout << ifs2.rdstate( ) << endl;
	}
	cout << ii << ' ' << dd << ' ' << ss1 << ' ' << ss2 << endl;
	ifs2.close( );

	cout << "--------------second---------------" << endl;
	ifs2.clear( );
	ifs2.seekg( 0, ios::beg );
	ifs2 >> ii >> dd >> ss1 >> ss2;
	if( !ifs2 ) {
		cout << "ifs2 read err" << endl;
		cout << ifs2.good( ) << ifs2.bad( ) << ifs2.eof( ) << ifs2.fail( ) << endl;
		cout << ifs2.rdstate( ) << endl;
	}
	cout << ii << ' ' << dd << ' ' << ss1 << ' ' << ss2 << endl;
	ifs2.close( );

	return 0;
}

